﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="StockOutSP_ExtendForm.aspx.vb" Inherits="PubProject.StockOutSP_ExtendForm" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o="urn:schemas-microsoft-com:office:office">
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<link rel="stylesheet" type="text/css" href="/_forms/styles/form.css">
		<script language="javascript" src="/_common/scripts/global.js"></script>
		<script language="javascript" src="/_controls/settings.aspx"></script>
		<script language="javascript" src="/_controls/util/util.js"></script>
		<script language="javascript" src="/_controls/number/number.js"></script>
		<script language="javascript" src="/_controls/datetime/date.js"></script>
		<script language="javascript" src="/MyWorkflow/Workflow.js"></script>
		<script language="javascript" src="/MyWorkflow/Blank.js"></script>
		<script language="javascript" src="/PubProject/js/Public.js"></script>		
		<script language="javascript" src="/CBGL/JS/BudgetCostUse.js"></script>
		<script language="javascript" src="/CBGL/JS/StockCostUse.js"></script>
		<script language="javascript" src="/CBGL/JS/Public.js"></script>
		<script language="javascript" src="/CBGL/DTCB/StockTransfer.js"></script>
		<style> body{font-size:9pt;}
	table{font-size:9pt;}
	P{font-size:9pt;}
		</style>
		<LINK href="/MyWorkflow/css/form.css" type="text/css" rel="stylesheet">
		<script language="javascript">
		    var ObjBudgetCostUse = null;//选择合约规划类
			var ObjStockCostUse = null; //选择公司库存类
			var IfDdhs=null;            //是否单独执行
			 var sCfTypeName,sCfSouce,sRefType,sRefGUID,sStockOutGUID;
			 
			/*------------------------------------------------------------------*/
			//表单接口函数，需扩展
			//1、Fill	--	表单填充
			//2、GetXML --	表单取数
			//3、Valid	--	表单校验
			/*------------------------------------------------------------------*/
			//屏避右键
			function document.oncontextmenu()
			{
				var s = event.srcElement.tagName;
				// For Selection Ranges, s will be UNDEFINED
				if (s && s != "INPUT" && s != "TEXTAREA" || event.srcElement.disabled || document.selection.createRange().text.length == 0)
				{
					event.returnValue = false;
				}
			}
			//功能：表单填充
			//editableDomainList	当前步骤可编辑域
			//invisibleDomainList   当前步骤不可见域
			//domainXML				域XML
			function Fill(editableDomainList,invisibleDomainList,domainXML)
			{
				var xmlDom = new ActiveXObject("Microsoft.XMLDOM"); 
				if (domainXML && domainXML.length>0)	
				{		
					xmlDom.async=false; 
					xmlDom.loadXML(domainXML);
					
					if(xmlDom.parseError.errorCode != 0) 
						xmlDom = null; 
				}
				else
				{
					xmlDom = null;
				}
 
				Form1.StockOutName.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='出库单名称']").text;
				Form1.StockCostName.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='库存科目']").text;				
				Form1.StockAmount.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='出库金额']").text;				
				Form1.Jbr.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='经办人']").text;
				Form1.JbRq.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='经办日期']").text;
				Form1.Remarks.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='结转说明']").text;
				
				Form1.UseCostInfo.style.cursor = "hand"
	            Form1.UseCostInfo.style.textDecorationUnderline = "true"
				
				var objlist = getHTMLDomainField(document);
				
				for(var i=0;i<objlist.length;i++)
				{ 	
					if((invisibleDomainList+",").indexOf(objlist[i].dm_name + ',')>-1)
					{
						//不可见域不显示
						objlist[i].style.display="none";
					}
				
					//不可编辑的disabled,可编辑的enabled
					if((editableDomainList+",").indexOf(objlist[i].dm_name + ',')>-1)
					{
						objlist[i].readOnly =false;
					}
					else
					{
						objlist[i].readOnly =true;
					}
				}
				sStockOutGUID = xmlDom.selectSingleNode("/BusinessType").attributes.getNamedItem("BusinessGUID").value;
				
				ObjBudgetCostUse = new BudgetCostUse("00000000-0000-0000-0000-000000000000",sStockOutGUID,"库存出库","库存","库存结转","库存");
								
				var sFile = "/Cbgl/DTCB/StockTransfer_XMLHTTP.aspx?StockOutGUID=" + escape(sStockOutGUID);
				//debugger;
				var sRtn = openXMLHTTP(sFile,"GetSPRefInfo");
				//alert(sRtn);
                if (""!=sRtn)
                {
                    //返回  合约规划名称+金额
                    Form1.UseCostInfo.value = sRtn;
                                        
                }
                
			}
			
			//功能：表单取数
			//参数：取值前的domainxml
			//返回值 取值后的domainxml
			function GetXML(domainXML)
			{
				var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
				 
				xmlDom.async=false;
				xmlDom.loadXML(domainXML);
						
				if(xmlDom.parseError.errorCode != 0) return "";			
				
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='出库单名称']").text = Form1.StockOutName.value;
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='库存科目']").text = Form1.StockCostName.value;				
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='出库金额']").text = Form1.StockAmount.value;				
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='经办人']").text = Form1.Jbr.value;
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='经办日期']").text = Form1.JbRq.value;
				xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='结转说明']").text = Form1.Remarks.value;
				
				return xmlDom.xml;	
			}
			
			//功能：表单校验
			//参数：可编辑域列表
			function Valid(editableDomainList)
			{
				return true;
			}
			
			//功能：发起审批时校验			
			function InitValidate()
			{	
			    if(!CheckCompel(sStockOutGUID,"发起审批")) return false;

			    if(UpdateState(sStockOutGUID, "ProcessLaunchCheck"))
		        {
			       return true;
			    }
                
				return false;
			}
			
			
function ChgUseCost()
{
    //aobo add on 20081028 选择合约规划
	if (null==ObjBudgetCostUse)
	{
        return; 	
	}
	
	if (document.readyState != "complete")
	{
		alert("当前页面没有加载完，请稍候保存！");
		event.returnValue = false;
	    return;
	}
	
    var mode = "3";	
    //var kFtAmount = stringToFloat(Form1.HtAmount_Bz.value) - stringToFloat(ObjStockCostUse.GetYCfAmount());	
    
    if(ObjBudgetCostUse.UpdateData(stringToFloat(Form1.StockAmount.value),mode,'0','0','0'))
    {    		
	    //alert(ObjBudgetCostUse.GetYCfAmount());
    }	
	
}
	
//
//aobo add on 20081016 显示合约规划信息
//	
 function openViewLayer(vBudgetList)
 {
    //var BudgetList = Form1.txtBudgetList.value
    //if (BudgetList==undefined || BudgetList=="") return false;
    if (vBudgetList.value ==undefined  || vBudgetList.value=="")  return false;

	var xmlBudget;
	var i;
	var sBudgetGUID;
	
	sBudgetGUID="";
//	xmlBudget = new ActiveXObject("Microsoft.XMLDOM");
//	xmlBudget.async = false;
//	xmlBudget.loadXML(BudgetList);	
	//debugger;
	xmlBudget = ObjBudgetCostUse.DataXml;
	iRow =xmlBudget.getElementsByTagName("cb_BudgetUse/DataList/Row").length;
	for(i=0;i<iRow;i++)
	{
		node = xmlBudget.getElementsByTagName("cb_BudgetUse/DataList/Row")(i);
		
		//sBudgetGUID=sBudgetGUID + ""+node.selectSingleNode("BudgetGUID").text+",";
		sBudgetGUID=sBudgetGUID + ""+node.attributes.getNamedItem("BudgetGUID").text+",";
	}	
	if(sBudgetGUID!="")
	{
	  sBudgetGUID = sBudgetGUID.substring(0,sBudgetGUID.lastIndexOf(","))	
	  createBg(); 
      createCon(sBudgetGUID);    
	}
	else
	{
	   return false; 
	}
    
 }
					
			
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout" id="bodyId">
		<form id="Form1" method="post" runat="server">
			<asp:textbox id="ApplyUserGUID" runat="server" style="display:none"></asp:textbox>
			<asp:textbox id="ApplyDeptGUID" runat="server" style="display:none"></asp:textbox>
			<asp:textbox id="ResultTypeGUID" runat="server" style="display:none"></asp:textbox>
			<asp:textbox id="WorkResultGUID" runat="server" style="display:none"></asp:textbox>	
			<TABLE width="100%">
				<TBODY>
					<TR>
						<TD><!-- 表单 -->
						    <br>
							<P align="center" id="pTitle"><FONT style="FONT-SIZE: 16px"><STRONG>出库单审批表</STRONG></FONT></P>
							<br>
							<P align="center">
								<TABLE style="TABLE-LAYOUT: fixed; WIDTH: 90%; BORDER-COLLAPSE: collapse" borderColor="#517dbf"
									cellSpacing="2" cellPadding="3" align="center" bgColor="#ffffff" border="1">
									<colgroup>
										<col width="100">
										<col>
										<col width="100">
										<col>										
									</colgroup>									
									
									<TR height="25">
										<TD>
											出库单名称
										</TD>
										<TD colspan=3>
											<INPUT class="txt" id="StockOutName" style="WIDTH: 80%; HEIGHT: 100%" maxLength="4000"
												dm_name="出库单名称">
										</TD>
										
									</TR>
									<TR height="25">
										<TD>
											库存科目
										</TD>
										<TD colspan=3>
											<INPUT class="txt" id="StockCostName" style="WIDTH: 80%; HEIGHT: 100%" maxLength="4000"
												dm_name="库存科目">
										</TD>										
									</TR>
									<TR height="25">
										<TD>
											出库金额
										</TD>
										<TD colspan=3>
											<INPUT class="txt" id="StockAmount" style="WIDTH: 80%; HEIGHT: 100%" maxLength="4000"
												dm_name="出库金额">
										</TD>										
									</TR>									
									
									<TR height="25">
										<TD>
											经办人
										</TD>
										<TD>
											<INPUT class="txt" id="Jbr" style="WIDTH: 100%; HEIGHT: 100%" maxLength="4000"
												dm_name="经办人">
										</TD>
										<TD>
											经办日期
										</TD>
										<TD >
											<INPUT class="txt" id="JbRq" style="WIDTH: 100%; HEIGHT: 100%" maxLength="100" dm_name="经办部门"> 
										</TD>
									</TR>
									
									<TR height="70">										
										<TD colspan=4>
											<table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed">
                                                <col width=70/><col width=50 /><col /><col width="25" align="right"/><col width=70/>
                                                <tr>
                                                    <td align=right></td> 
                                                    <td>合约规划</td>
                                                    <td><input type="text" class="txt" readOnly ro="0" name="UseCostInfo" value="" maxlength="2000" onclick="openViewLayer(this)"></td>
                                                    <td align="right"><img style="cursor:hand" src="/_imgs/btn_off_lookup.gif" onclick="ChgUseCost()"></td>
                                                    <td></td>
                                                </tr>
                                                <tr height="5"><td align=right colspan=5></td> </tr>
                                            </table>
                                           
										</TD>
										
									</TR>									
									<TR height="240">
										<TD align=center>
											结转说明
										</TD>
										<TD colspan=3>
                                            <textarea  style="WIDTH: 100%; HEIGHT:100%" id="Remarks" cols="140" rows="18"  dm_name="结转说明"></textarea>
										</TD>										
									</TR>																	
									
								</TABLE>
							</P>
							<br><br>
						</TD>
					</TR>					
				</TBODY>
			</TABLE>
		</form>
	</body>
</HTML>